# -*- coding: utf-8 -*-
# @Time    : 2018/6/5 下午11:01
# @Author  : Lavn
# @Email   : 959875529@qq.com
# @File    : enumDemo.py
# @Software: PyCharm

# from enum import Enum

# Month = Enum('Month', ('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'))
#
# # 遍历枚举类型
# for name, member in Month.__members__.items():
#     print(name, '---------', member, '----------', member.value)
#
#
# # 直接引用一个常量
# print('\n', Month.Jan)


# #自定义类型的枚举
# from enum import Enum, unique
# Enum('Month', ('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'))
# # @unique 装饰器可以帮助我们检查保证没有重复值
# class Month(Enum):
#     Jan = 'January'
#     Feb = 'February'
#     Mar = 'March'
#     Apr = 'April'
#     May = 'May'
#     Jun = 'June'
#     Jul = 'July'
#     Aug = 'August'
#     Sep = 'September '
#     Oct = 'October'
#     Nov = 'November'
#     Dec = 'December'
#
# if __name__ == '__main__':
#     print(Month.Jan, '----------',
#           Month.Jan.name, '----------', Month.Jan.value)
#     for name, member in Month.__members__.items():
#         print(name, '----------', member, '----------', member.value)



#枚举的比较
# from enum import Enum
#
#
# class User(Enum):
#     Twowater = 98
#     Liangdianshui = 30
#     Tom = 12
#
#
# Twowater = User.Twowater
# Liangdianshui = User.Liangdianshui
#
# print(Twowater == Liangdianshui, Twowater == User.Twowater)
# print(Twowater is Liangdianshui, Twowater is User.Twowater)
#
# try:
#     print('\n'.join('  ' + s.name for s in sorted(User)))
# except TypeError as err:
#     print(' Error : {}'.format(err))



import enum


class User(enum.IntEnum):
    Twowater = 98
    Liangdianshui = 30
    Tom = 12
try:
    print('--'.join(s.name for s in sorted(User)))
except TypeError as err:
    print(' Error : {}'.format(err))

